home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 6 / FM Towns Free Software Collection 6.iso / t_os / helper / source / graphic.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-08  |  26.9 KB  |  1,166 lines

  1. #include    <stdio.h>
  2. #include    <stdlib.h>
  3. #include    <stdarg.h>
  4. #include    <string.h>
  5. #include    <time.h>
  6. #include    <egb.h>
  7. #include    <mos.h>
  8. #include    <snd.h>
  9. #include    <msdos.cf>
  10. #include    "graphic.h"
  11. #include    "coldef.h"
  12. #include    "dir.h"
  13.  
  14. #define    TRUE    1
  15. #define    FALSE    0
  16. #define    ERR    (-1)
  17.  
  18.     int    tick_timer = 0;
  19.     int    now_mos = 0;
  20.     int    screen_flg = FALSE;
  21.     char    work[EgbWorkSize];
  22.     char    mwork[MosWorkSize];
  23.     char    swork[16384];
  24.  
  25. static    void    (*timer_addr)() = (void (*)())0;
  26. static    char    *eup_buf = NULL;
  27. static struct _PLT {
  28.     char    b,r,g;
  29.     } plt_tbl[16]={
  30.     { 0,0,0 },    { 14,12,13 },
  31.     { 6,13,4 },    { 7,5,6 },
  32.     { 6,4,5 },    { 5,3,4 },
  33.     { 4,2,3 },    { 3,1,2 },
  34.     { 9,7,8 },    { 0,0,0 },
  35.     { 8,2,12 },    { 9,7,8 },
  36.     { 8,6,7 },    { 7,5,6 },
  37.     { 10,8,9 },    { 15,13,14 }
  38.     };
  39.  
  40. static char    mosptn[][66]={
  41.     { 2, 16,
  42.     0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, 0x00, 
  43.     0x30, 0x00, 0x58, 0x00, 0x3C, 0x00, 0x5E, 0x00, 
  44.     0x2F, 0x00, 0x5F, 0x80, 0x2E, 0x00, 0x7C, 0x00, 
  45.     0x66, 0x00, 0x06, 0x00, 0x03, 0x00, 0x00, 0x00, 
  46.     0x7F, 0xFF, 0x3F, 0xFF, 0x5F, 0xFF, 0x6F, 0xFF, 
  47.     0x37, 0xFF, 0x5B, 0xFF, 0x3D, 0xFF, 0x5E, 0xFF, 
  48.     0x2F, 0x7F, 0x5F, 0xBF, 0x2E, 0x7F, 0x7D, 0xFF, 
  49.     0x66, 0xFF, 0x16, 0xFF, 0x7B, 0x7F, 0xF8, 0x7F },
  50.     { 2, 16,
  51.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x40, 
  52.     0x05, 0x40, 0x05, 0x50, 0x15, 0x50, 0x15, 0x50, 
  53.     0x1F, 0xF0, 0x1F, 0xF0, 0x1F, 0xF0, 0x0F, 0xF0, 
  54.     0x07, 0xE0, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00,
  55.     0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xBF, 0xF5, 0x5F, 
  56.     0xF5, 0x4F, 0xE5, 0x57, 0xD5, 0x57, 0xD5, 0x57, 
  57.     0xDF, 0xF7, 0xDF, 0xF7, 0xDF, 0xF7, 0xEF, 0xF7, 
  58.     0xF7, 0xEF, 0xFB, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF },
  59.     { 2, 16,
  60.     0x00, 0x00, 0x2F, 0xF4, 0x2F, 0xF4, 0x2F, 0xF4, 
  61.     0x37, 0xEC, 0x39, 0x9C, 0x3C, 0x3C, 0x3E, 0x7C, 
  62.     0x3E, 0x7C, 0x3D, 0xBC, 0x3B, 0xDC, 0x36, 0x6C, 
  63.     0x2C, 0x34, 0x28, 0x14, 0x20, 0x04, 0x00, 0x00,
  64.     0x00, 0x00, 0xAF, 0xF5, 0xAF, 0xF5, 0xAF, 0xF5, 
  65.     0xB7, 0xED, 0xB9, 0x9D, 0xBC, 0x3D, 0xBE, 0x7D, 
  66.     0xBE, 0x7D, 0xBD, 0xBD, 0xBB, 0xDD, 0xB6, 0x6D, 
  67.     0xAC, 0x35, 0xA8, 0x15, 0xA0, 0x05, 0x00, 0x00 },
  68.     { 2, 16,
  69.     0x03, 0x00, 0x03, 0x80, 0x02, 0xC0, 0x02, 0x40, 
  70.     0x02, 0x40, 0x02, 0x00, 0x0E, 0x00, 0x1E, 0x00, 
  71.     0x1E, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x6A, 0xE0, 
  72.     0x4A, 0xA0, 0x6A, 0xE0, 0x4A, 0x80, 0x6E, 0x80,
  73.     0xFB, 0x7F, 0xFB, 0xBF, 0xFA, 0xDF, 0xFA, 0x5F, 
  74.     0xFA, 0x5F, 0xE2, 0x9F, 0xCE, 0xFF, 0xDE, 0xFF, 
  75.     0xDE, 0xFF, 0xCD, 0xFF, 0xE1, 0xFF, 0xFF, 0xFF, 
  76.     0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
  77.     { 2, 16,
  78.     0x00, 0x00, 0x07, 0x00, 0x08, 0x80, 0x0A, 0x40, 
  79.     0x01, 0x40, 0x05, 0x40, 0x02, 0x40, 0x08, 0x40, 
  80.     0x04, 0x80, 0x07, 0x00, 0x00, 0x00, 0x75, 0x60, 
  81.     0x47, 0x50, 0x77, 0x50, 0x17, 0x50, 0x75, 0x60,
  82.     0xF0, 0x7F, 0xF7, 0x7F, 0xE8, 0xBF, 0xEA, 0x5F, 
  83.     0xE1, 0x5F, 0xE5, 0x5F, 0xE2, 0x5F, 0xE8, 0x5F, 
  84.     0xF4, 0xBF, 0xF7, 0x7F, 0xF0, 0x7F, 0xFF, 0xFF, 
  85.     0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } };
  86.  
  87. void    DSP_mos(int no)
  88. {
  89.     now_mos = no;
  90.     MOS_type(1,0,0,mosptn[no]);
  91. }
  92. BLOCK    *DSP_push_vram(int x1,int y1,int x2,int y2)
  93. {
  94.     register BLOCK *para;
  95.     int     n;
  96.  
  97.     n = ((x2 - x1 + 8) / 8 * 4) * (y2 - y1 + 1) + 16;    /* 4 Bit Pix */
  98.  
  99.     if ( (para = (BLOCK *)malloc(n)) == NULL )
  100.     return NULL;
  101.  
  102.     para->ptn = para->img;
  103.     para->sel = getds();
  104.     para->x1 = x1;
  105.     para->y1 = y1;
  106.     para->x2 = x2;
  107.     para->y2 = y2;
  108.     EGB_getBlock(work,(char *)para);
  109.     return para;
  110. }
  111. void    DSP_pop_vram(BLOCK *para)
  112. {
  113.     if ( para == NULL )
  114.     return;
  115.     EGB_putBlock(work,0,(char *)para);
  116.     free(para);
  117. }
  118. void    DSP_putptn(char *ptn,int x1,int y1,int x2,int y2,
  119.             int fc,int bc,int md)
  120. {
  121.     BLOCK para;
  122.  
  123.     para.ptn = ptn;
  124.     para.sel = getds();
  125.     para.x1 = x1;
  126.     para.y1 = y1;
  127.     para.x2 = x2;
  128.     para.y2 = y2;
  129.     EGB_color(work,0,fc);
  130.     EGB_color(work,1,bc);
  131.     EGB_writeMode(work,md);
  132.     EGB_putBlockColor(work,0,(char *)(¶));
  133.     EGB_writeMode(work,0);
  134. }
  135. void    DSP_strimg(char *ptn, int x, int y, int fc, int bc, int mod)
  136. {
  137.     BLOCK para;
  138.  
  139.     para.ptn = ptn + 4;
  140.     para.sel = getds();
  141.     para.x1 = x;
  142.     para.y1 = y;
  143.     para.x2 = x + (unsigned char)(ptn[0]) + (unsigned char)(ptn[1]) * 256 - 1;
  144.     para.y2 = y + (unsigned char)(ptn[2]) + (unsigned char)(ptn[3]) * 256 - 1;
  145.     EGB_color(work,0,fc);
  146.     EGB_color(work,1,bc);
  147.     EGB_writeMode(work,mod);
  148.     EGB_putBlockColor(work,0,(char *)(¶));
  149.     EGB_writeMode(work,0);
  150. }
  151. void    DSP_msg(char *str,int x,int y,int font,int fc,int bc,int mod)
  152. {
  153.     struct {
  154.     short int    x,y;
  155.     short int    len;
  156.     char        str[120];
  157.     } msg;
  158.  
  159.     msg.x = x;
  160.     msg.y = y + 15;
  161.     msg.len = strlen(str);
  162.     strcpy(msg.str,str);
  163.  
  164.     EGB_textSpace(work,0);
  165.     EGB_fontStyle(work,font);
  166.     EGB_color(work,0,fc);
  167.     EGB_color(work,1,bc);
  168.     EGB_writeMode(work,mod);
  169.     EGB_sjisString(work,(char *)&msg);
  170. }
  171. void    DSP_line(int x1,int y1,int x2,int y2,int col,int mod)
  172. {
  173.     struct {
  174.     short int    x1,y1,x2,y2;
  175.     } line;
  176.  
  177.     line.x1 = x1;
  178.     line.y1 = y1;
  179.     line.x2 = x2;
  180.     line.y2 = y2;
  181.     EGB_paintMode(work,0x002);
  182.     EGB_color(work,0,col);
  183.     EGB_writeMode(work,mod);
  184.     EGB_rectangle(work,(char *)&line);
  185.     EGB_writeMode(work,0);
  186. }
  187. void    DSP_box(int x1,int y1,int x2,int y2,int col,int mod)
  188. {
  189.     struct {
  190.     short int    x1,y1,x2,y2;
  191.     } line;
  192.  
  193.     line.x1 = x1;
  194.     line.y1 = y1;
  195.     line.x2 = x2;
  196.     line.y2 = y2;
  197.     EGB_paintMode(work,0x022);
  198.     EGB_color(work,0,col);
  199.     EGB_color(work,2,col);
  200.     EGB_writeMode(work,mod);
  201.     EGB_rectangle(work,(char *)&line);
  202.     EGB_writeMode(work,0);
  203. }
  204. void    DSP_rbox(int x1,int y1,int x2,int y2,int lin,int col,int mod)
  205. {
  206.     struct {
  207.     short int    x1,y1,x2,y2;
  208.     } line;
  209.  
  210.     line.x1 = x1;
  211.     line.y1 = y1;
  212.     line.x2 = x2;
  213.     line.y2 = y2;
  214.     EGB_paintMode(work,0x022);
  215.     EGB_color(work,0,lin);
  216.     EGB_color(work,2,col);
  217.     EGB_writeMode(work,mod);
  218.     EGB_rectangle(work,(char *)&line);
  219.     EGB_writeMode(work,0);
  220. }
  221. void    DSP_wbox(int x1,int y1,int x2,int y2,int lin,int col,int mod)
  222. {
  223.     struct {
  224.     short int    point;
  225.     short int    trx2,try2;
  226.     short int    trx3,try3;
  227.     short int    brx1,bry1;
  228.     short int    brx2,bry2;
  229.     short int    brx3,bry3;
  230.     short int    blx1,bly1;
  231.     short int    blx2,bly2;
  232.     short int    blx3,bly3;
  233.     short int    tlx1,tly1;
  234.     short int    tlx2,tly2;
  235.     short int    tlx3,tly3;
  236.     short int    trx1,try1;
  237.     } poly;
  238.  
  239.     poly.point = 12;
  240.  
  241.     poly.tlx1 = x1+0; poly.tlx2 = x1+1; poly.tlx3 = x1+2;
  242.     poly.tly1 = y1+2; poly.tly2 = y1+1; poly.tly3 = y1+0;
  243.  
  244.     poly.trx1 = x2-2; poly.trx2 = x2-1; poly.trx3 = x2+0;
  245.     poly.try1 = y1+0; poly.try2 = y1+1; poly.try3 = y1+2;
  246.  
  247.     poly.brx1 = x2+0; poly.brx2 = x2-1; poly.brx3 = x2-2;
  248.     poly.bry1 = y2-2; poly.bry2 = y2-1; poly.bry3 = y2+0;
  249.  
  250.     poly.blx1 = x1+2; poly.blx2 = x1+1; poly.blx3 = x1+0;
  251.     poly.bly1 = y2-0; poly.bly2 = y2-1; poly.bly3 = y2-2;
  252.  
  253.     EGB_paintMode(work,0x022);
  254.     EGB_color(work,0,lin);
  255.     EGB_color(work,2,col);
  256.     EGB_writeMode(work,mod);
  257.     EGB_polygon(work,(char *)&poly);
  258.  
  259.     poly.point = 7;
  260.     EGB_paintMode(work,0x002);
  261.     EGB_color(work,0,lin ^ 0x08);
  262.     EGB_connect(work,(char *)&poly);
  263.  
  264.     EGB_writeMode(work,0);
  265. }
  266. void    DSP_vsync(void)
  267. {
  268.     while ( (peek(0xFDA0) & 1) != 0 );
  269.     while ( (peek(0xFDA0) & 1) == 0 );
  270. }
  271. void    DSP_opbox(int x1,int y1,int x2,int y2)
  272. {
  273.     int     i;
  274.     int     ix1,iy1,ix2,iy2;
  275.     int     sx1,sy1,sx2,sy2;
  276.  
  277.     ix1 = (x1 + x2) / 2 - 8;
  278.     ix2 = ix1 + 15;
  279.     iy1 = (y1 + y2) / 2 - 8;
  280.     iy2 = iy1 + 15;
  281.  
  282.     sx1 = (ix1 - x1) / 10;
  283.     sy1 = (iy1 - y1) / 10;
  284.     sx2 = (x2 - ix2) / 10;
  285.     sy2 = (y2 - iy2) / 10;
  286.  
  287.     for ( i = 10 ; i >= 0 ; i-- ) {
  288.     DSP_line(ix1,iy1,ix2,iy2,15,4);
  289.     DSP_vsync();
  290.     DSP_line(ix1,iy1,ix2,iy2,15,4);
  291.     ix1 -= sx1;
  292.     iy1 -= sy1;
  293.     ix2 += sx2;
  294.     iy2 += sy2;
  295.     }
  296. }
  297. void    DSP_clbox(int x1,int y1,int x2,int y2)
  298. {
  299.     int     i;
  300.     int     ix1,iy1,ix2,iy2;
  301.     int     sx1,sy1,sx2,sy2;
  302.  
  303.     ix1 = (x1 + x2) / 2 - 8;
  304.     ix2 = ix1 + 15;
  305.     iy1 = (y1 + y2) / 2 - 8;
  306.     iy2 = iy1 + 15;
  307.  
  308.     sx1 = (ix1 - x1) / 10;
  309.     sy1 = (iy1 - y1) / 10;
  310.     sx2 = (x2 - ix2) / 10;
  311.     sy2 = (y2 - iy2) / 10;
  312.  
  313.     for ( i = 10 ; i >= 0 ; i-- ) {
  314.     DSP_line(x1,y1,x2,y2,15,4);
  315.     DSP_vsync();
  316.     DSP_line(x1,y1,x2,y2,15,4);
  317.     x1 += sx1;
  318.     y1 += sy1;
  319.     x2 -= sx2;
  320.     y2 -= sy2;
  321.     }
  322. }
  323. void    DSP_palette(void)
  324. {
  325.     struct {
  326.     int    cnt;
  327.     int    col;
  328.     char    b,r,g;
  329.     char    btm;
  330.     } para;
  331.     int     i;
  332.  
  333.     for ( i = 0 ; i < 16 ; i++ ) {
  334.     para.cnt = 1;
  335.     para.col = i;
  336.     para.b = plt_tbl[i].b * 16;
  337.     para.r = plt_tbl[i].r * 16;
  338.     para.g = plt_tbl[i].g * 16;
  339.     para.btm = 0;
  340.         EGB_palette(work,0,(char *)¶);
  341.     }
  342. }
  343. void    TICK_count(void)
  344. {
  345.     tick_timer++;
  346.     timer_addr();
  347. }
  348. void    DSP_init(void)
  349. {
  350.     SND_init(swork);
  351.     SND_rs_midi_init();
  352.     SND_eup_init(swork);
  353.     SND_elevol_mute(0xB3);
  354.  
  355.     timer_addr = SND_int_timer_a_get();
  356.     SND_int_timer_a_set(TICK_count);
  357.     SND_fm_timer_a_set(1,900);
  358.  
  359.     EGB_init(work,EgbWorkSize);
  360.     EGB_resolution(work,0,3);
  361.     EGB_resolution(work,1,3);
  362.     EGB_displayPage(work,0,3);
  363.     EGB_writePage(work,1);
  364.     DSP_palette();
  365.     EGB_writePage(work,0);
  366.     DSP_palette();
  367.  
  368.     MOS_start(mwork,MosWorkSize);
  369.     MOS_resolution(0,3);
  370.     MOS_resolution(1,3);
  371.     MOS_writePage(0);
  372.     MOS_horizon(0,632);
  373.     MOS_vertical(0,470);
  374.     DSP_mos(MOS_NOMAL);
  375.     MOS_disp(TRUE);
  376.     ctblset(15, SCRN_COL);
  377. }
  378. void    DSP_end(void)
  379. {
  380.     MOS_end();
  381.     SND_elevol_mute(0x00);
  382.     SND_eup_end();
  383.     SND_rs_midi_end();
  384.     SND_end();
  385. }
  386. void    gprintf(int x,int y,int c,int b,char *form,...)
  387. {
  388.     va_list arg;
  389.     char    tmp[256];
  390.  
  391.     va_start(arg,form);
  392.     vsprintf((char *)tmp,form,arg);
  393.     wrtstr(tmp,0,x,y,c,b,16);
  394.     va_end(arg);
  395. }
  396. void    gputs(int x,int y,int c,int b,char *str)
  397. {
  398.     wrtstr(str,0,x,y,c,b,16);
  399. }
  400. void    DSP_offset(int page,int x,int y)
  401. {
  402.     vram_offset((page == 0 ? 17:21),x/8+y*128);
  403. }
  404. void    DSP_clear(int no)
  405. {
  406.     EGB_writePage(work,no);
  407.     EGB_color(work,1,0);
  408.     EGB_clearScreen(work);
  409.     EGB_writePage(work,0);
  410. }
  411. void    DSP_page(int no)
  412. {
  413.     EGB_writePage(work,no);
  414. }
  415. #include    "sysicon.c"
  416.  
  417. int    ESR_setupInfo(char *out_buf);
  418.  
  419. char    drv_tbl[]={
  420.     IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,
  421.     IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,
  422.     IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,IS_NON,IS_NON };
  423.  
  424. void    ICON_init(void)
  425. {
  426.     int     i;
  427.     char    tmp[256];
  428.  
  429.     ESR_setupInfo((char *)tmp);
  430.     for ( i = 0 ; i < 16 ; i++ )
  431.     drv_tbl[i] = tmp[0x30 + i * 2];
  432.     drv_tbl[2] = IS_NON;            /* C: drive delete */
  433.     drv_tbl[16] = IS_CDR;            /* Q: drive apend */
  434. }
  435. void    ICON_disp(int x,int y,int drv)
  436. {
  437.     DSP_rbox(x,y,x+33,y+33,XLINE_COL,WIND_COL,M_PSET);
  438.     if ( drv_tbl[drv] <= IS_CDR )
  439.     DSP_putptn(ICON_ptn[drv_tbl[drv]],x+1,y+1,x+32,y+32,
  440.                 CHR_COL,WIND_COL,M_PSET);
  441.     else
  442.     gprintf(x+12,y+12,CHR_COL,WIND_COL,"%d",drv_tbl[drv]);
  443.     DSP_box(x+2,y+2,x+15,y+14,WIND_COL,M_PSET);
  444.     DSP_putptn(DIGIT_ptn[drv],x+2,y+2,x+15,y+14,CHR_COL,WIND_COL,M_PSET);
  445. }
  446.  
  447. /********************************************************************
  448.  
  449.     Palette Control
  450.  
  451.     0      1        2          3        4      5
  452.     0123456789012345678901234567890123456789012345678901234567890
  453. 0    ■  < 00 >  < 00 >  < 00 >    ■  < 00 >  < 00 >  < 00 >
  454. 1    ■  < 00 >  < 00 >  < 00 >    ■  < 00 >  < 00 >  < 00 >
  455. 2    ■  < 00 >  < 00 >  < 00 >    ■  < 00 >  < 00 >  < 00 >
  456. 3    ■  < 00 >  < 00 >  < 00 >    ■  < 00 >  < 00 >  < 00 >
  457. 4    ■  < 00 >  < 00 >  < 00 >    ■  < 00 >  < 00 >  < 00 >
  458. 5    ■  < 00 >  < 00 >  < 00 >    ■  < 00 >  < 00 >  < 00 >
  459. 6    ■  < 00 >  < 00 >  < 00 >    ■  < 00 >  < 00 >  < 00 >
  460. 7    ■  < 00 >  < 00 >  < 00 >    ■  < 00 >  < 00 >  < 00 >
  461.  
  462. ********************************************************************/
  463.  
  464. #define    PLT_X    80
  465. #define    PLT_Y    140
  466.  
  467. #define    PLT_X1    PLT_X-8
  468. #define    PLT_Y1    PLT_Y-40
  469. #define    PLT_X2    PLT_X+480
  470. #define    PLT_Y2    PLT_Y+192
  471.  
  472. void    PLT_node(int col)
  473. {
  474.     int     x,y;
  475.     struct {
  476.     int    cnt;
  477.     int    col;
  478.     char    b,r,g;
  479.     char    btm;
  480.     } para;
  481.     
  482.     MOS_disp(0);
  483.  
  484.     x = PLT_X + (col % 2) * 256;
  485.     y = PLT_Y + (col / 2) * 22;
  486.  
  487.     DSP_wbox(x,y,x+19,y+19,LINE_COL,col,M_PSET);
  488.  
  489.     DSP_wbox(x+32,y,x+32+11,y+19,LINE_COL,WIND_COL,M_PSET);
  490.     gputs(x+32+2,y+2,CHR_COL,WIND_COL,"<");
  491.     DSP_wbox(x+72,y,x+72+11,y+19,LINE_COL,WIND_COL,M_PSET);
  492.     gputs(x+72+2,y+2,CHR_COL,WIND_COL,">");
  493.  
  494.     DSP_wbox(x+96,y,x+96+11,y+19,LINE_COL,WIND_COL,M_PSET);
  495.     gputs(x+96+2,y+2,CHR_COL,WIND_COL,"<");
  496.     DSP_wbox(x+136,y,x+136+11,y+19,LINE_COL,WIND_COL,M_PSET);
  497.     gputs(x+136+2,y+2,CHR_COL,WIND_COL,">");
  498.  
  499.     DSP_wbox(x+160,y,x+160+11,y+19,LINE_COL,WIND_COL,M_PSET);
  500.     gputs(x+160+2,y+2,CHR_COL,WIND_COL,"<");
  501.     DSP_wbox(x+200,y,x+200+11,y+19,LINE_COL,WIND_COL,M_PSET);
  502.     gputs(x+200+2,y+2,CHR_COL,WIND_COL,">");
  503.  
  504.     gprintf(x+48+2,y+2,CHR_COL,WIND_COL,"%02d",plt_tbl[col].b);
  505.     gprintf(x+112+2,y+2,CHR_COL,WIND_COL,"%02d",plt_tbl[col].r);
  506.     gprintf(x+176+2,y+2,CHR_COL,WIND_COL,"%02d",plt_tbl[col].g);
  507.  
  508.     para.cnt = 1;
  509.     para.col = col;
  510.     para.b = plt_tbl[col].b * 16;
  511.     para.r = plt_tbl[col].r * 16;
  512.     para.g = plt_tbl[col].g * 16;
  513.     para.btm = 0;
  514.     EGB_palette(work,0,(char *)¶);
  515.  
  516.     MOS_disp(1);
  517. }
  518. void    PLT_chk(int mx,int my,int col)
  519. {
  520.     int     x,y;
  521.  
  522.     x = PLT_X + (col % 2) * 256;
  523.     y = PLT_Y + (col / 2) * 22;
  524.  
  525.     if      ( (mx >= (x+32)) && (my >= y) && 
  526.           (mx <= (x+32+11)) && (my <= (y+19)) )
  527.     plt_tbl[col].b = (plt_tbl[col].b - 1) & 0x0F;
  528.  
  529.     else if ( (mx >= (x+72)) && (my >= y) && 
  530.           (mx <= (x+72+11)) && (my <= (y+19)) )
  531.     plt_tbl[col].b = (plt_tbl[col].b + 1) & 0x0F;
  532.  
  533.     else if ( (mx >= (x+96)) && (my >= y) && 
  534.           (mx <= (x+96+11)) && (my <= (y+19)) )
  535.     plt_tbl[col].r = (plt_tbl[col].r - 1) & 0x0F;
  536.  
  537.     else if ( (mx >= (x+136)) && (my >= y) && 
  538.           (mx <= (x+136+11)) && (my <= (y+19)) )
  539.     plt_tbl[col].r = (plt_tbl[col].r + 1) & 0x0F;
  540.  
  541.     else if ( (mx >= (x+160)) && (my >= y) && 
  542.           (mx <= (x+160+11)) && (my <= (y+19)) )
  543.     plt_tbl[col].g = (plt_tbl[col].g - 1) & 0x0F;
  544.  
  545.     else if ( (mx >= (x+200)) && (my >= y) && 
  546.           (mx <= (x+200+11)) && (my <= (y+19)) )
  547.     plt_tbl[col].g = (plt_tbl[col].g + 1) & 0x0F;
  548.  
  549.     else
  550.     return;
  551.  
  552.     PLT_node(col);
  553. }
  554. void    PLT_control(void)
  555. {
  556.     int     n,i;
  557.     int     x,y,sw;
  558.     BLOCK   *vp;
  559.  
  560.     MOS_disp(0);
  561.     vp = DSP_push_vram(PLT_X1,PLT_Y1,PLT_X2,PLT_Y2);
  562.     DSP_opbox(PLT_X1,PLT_Y1,PLT_X2,PLT_Y2);
  563. /****
  564.     DSP_wbox(PLT_X1,PLT_Y1,PLT_X2,PLT_Y2,LINE_COL,WIND_COL,M_PSET);
  565. *****/
  566.     DSP_wbox(PLT_X1+8,PLT_Y1+8,PLT_X1+38,PLT_Y1+27,LINE_COL,WIND_COL,M_PSET);
  567.     gputs(PLT_X1+10,PLT_Y1+10,CHR_COL,WIND_COL,"END");
  568.     MOS_disp(1);
  569.  
  570.     for ( i = 0 ; i < 16 ; i++ )
  571.     PLT_node(i);
  572.  
  573.     for ( ; ; ) {
  574.     MOS_rdpos(&sw,&x,&y);
  575.  
  576.     if ( (sw == 0)    ||
  577.          (x < PLT_X1) || (y < PLT_Y1) ||
  578.          (x > PLT_X2) || (y > PLT_Y2) )
  579.         continue;
  580.  
  581.     else if ( (x >= (PLT_X1+8))  && (y >= (PLT_Y1+8)) &&
  582.               (x <= (PLT_X1+38)) && (y <= (PLT_Y1+27)) )
  583.         break;
  584.  
  585.     else {
  586.         for ( i = 0 ; i < 16 ; i++ )
  587.             PLT_chk(x,y,i);
  588.     }
  589.  
  590.     do {
  591.         MOS_rdpos(&sw,&x,&y);
  592.     } while ( sw != 0 );
  593.     }
  594.  
  595.     MOS_disp(0);
  596.     DSP_pop_vram(vp);
  597.     MOS_disp(1);
  598. }
  599.  
  600. /****************************************************
  601.  
  602.     TIFF Graphic Display and SND or EUP Play
  603.  
  604. *****************************************************/
  605. char    *getins(env,file)
  606. char    *env,*file;
  607. {
  608.     static char tmp[128];
  609.     char *p;
  610.  
  611.     if ( (p = getenv(env)) == NULL )
  612.     return NULL;
  613.     sprintf(tmp,"%s\\%s",p,file);
  614.     return tmp;
  615. }
  616. char    *xopen(char *file)
  617. {
  618.     FILE    *fp;
  619.     long    fsz;
  620.     char    *buf;
  621.  
  622.     DSP_mos(2);
  623.     if( (fp = fopen(file,"rb")) == NULL )
  624.     return NULL;
  625.  
  626.     fseek(fp,0L,SEEK_END);
  627.     fsz = ftell(fp);
  628.     rewind(fp);
  629.  
  630.     if( (buf = (char *)malloc(fsz)) == NULL)
  631.     goto ERROR;
  632.  
  633.     fread(buf,fsz,1,fp);
  634.  
  635. ERROR:
  636.     fclose(fp);
  637.     DSP_mos(0);
  638.     return buf;
  639. }
  640. void    xclose(char *buf)
  641. {
  642.     free(buf);
  643. }
  644. void    mos_wait()
  645. {
  646.     int     sw,x,y;
  647.     time_t  s,e;
  648.  
  649.     time(&s);
  650.     do {
  651.     time(&e);
  652.     MOS_rdpos(&sw,&x,&y);
  653.     } while ( sw == 0 && (e - s) < 20 );
  654. }
  655.  
  656. /**************** move to tiff.c ****************
  657. void    DSP_tiff(char *file)
  658. {
  659.     int        l,n;
  660.     int     x,y;
  661.     int     len,lzw,plt;
  662.     BLOCK   para;
  663.     BLOCK   *save;
  664.     char    *buf;
  665.     short   *rp,*gp,*bp;
  666.     struct _TIF {
  667.     short    tf_tag;
  668.     short    tf_type;
  669.     int    tf_len;
  670.     int    tf_data;
  671.     } *ifd;
  672.     struct {
  673.     int    cnt;
  674.     int    col;
  675.     char    b,r,g;
  676.     char    btm;
  677.     } plpara;
  678.  
  679.     if ( (buf = xopen(file)) == NULL ) {
  680.     kakunin("TIFFファイルの読み込みに失敗しました");
  681.     return;
  682.     }
  683.  
  684.     DSP_mos(4);
  685.  
  686.     if ( buf[0] != 0x49 || buf[1] != 0x49 || buf[2] != 0x2A ) {
  687.     kakunin("このファイルはTIFF形式ではありません?");
  688.     goto ENDOF;
  689.     }
  690.  
  691.     x = y = len = plt = 0;
  692.     lzw = 1;
  693.     n = WORD(buf + DWORD(buf+4));
  694.     ifd = (struct _TIF *)(buf + DWORD(buf+4) + 2);
  695.  
  696.     while ( n-- > 0) {
  697.     if ( ifd->tf_tag == 0 )
  698.         break;
  699.     switch(ifd->tf_tag){
  700.     case 0x0100: x = ifd->tf_data; break;
  701.     case 0x0101: y = ifd->tf_data; break;
  702.     case 0x0102: len = ifd->tf_data; break;
  703.     case 0x0103: lzw = ifd->tf_data; break;
  704.     case 0x0140: plt = ifd->tf_data; break;
  705.     case 0x0111: l = ifd->tf_data; break;
  706.     }
  707.     ifd++;
  708.     }
  709.  
  710.     if ( lzw != 1 ) {
  711.     kakunin("残念ながら圧縮TIFFに対応してません");
  712.     goto ENDOF;
  713.     }
  714.     if ( len != 1 && len != 4 && len != 8 && len != 16 ) {
  715.     kakunin("対応していないピクセルモ-ドです");
  716.     goto ENDOF;
  717.     }
  718.  
  719.     para.ptn = buf + l;
  720.     para.sel = getds();
  721.     para.x1 = 0;
  722.     para.y1 = 0;
  723.     para.x2 = x-1;
  724.     para.y2 = y-1;
  725.  
  726.     MOS_disp(OFF);
  727.     save = DSP_push_vram(0,0,639,479);
  728.     EGB_displayPage(work,0,0);
  729.  
  730.     switch(len) {
  731.     case 1:
  732.         EGB_resolution(work,0,3);
  733.     EGB_writePage(work,0);
  734.     EGB_clearScreen(work);
  735.     EGB_color(work,0,15);
  736.     EGB_putBlockColor(work,0,(char *)¶);
  737.     break;
  738.  
  739.     case 4:
  740.         EGB_resolution(work,0,3);
  741.     EGB_writePage(work,0);
  742.     EGB_clearScreen(work);
  743.     EGB_putBlock(work,0,(char *)¶);
  744.     if ( plt != 0 ) {
  745.         rp = (short *)(buf + plt);
  746.         gp = (short *)(buf + plt + 32);
  747.         bp = (short *)(buf + plt + 64);
  748.         for ( n = 0 ; n < 16 ; n++ ) {
  749.         plpara.cnt = 1;
  750.         plpara.col = n;
  751.         plpara.b = *(bp++);
  752.         plpara.r = *(rp++);
  753.         plpara.g = *(gp++);
  754.         plpara.btm = 0;
  755.         EGB_palette(work,0,(char *)&plpara);
  756.         }
  757.     }
  758.     break;
  759.  
  760.     case 8:
  761.     EGB_resolution(work,0,12);
  762.     EGB_clearScreen(work);
  763.     EGB_putBlock(work,0,(char *)¶);
  764.     if ( plt != 0 ) {
  765.         rp = (short *)(buf + plt);
  766.         gp = (short *)(buf + plt + 512);
  767.         bp = (short *)(buf + plt + 1024);
  768.         for ( n = 0 ; n < 256 ; n++ ) {
  769.         plpara.cnt = 1;
  770.         plpara.col = n;
  771.         plpara.b = *(bp++);
  772.         plpara.r = *(rp++);
  773.         plpara.g = *(gp++);
  774.         plpara.btm = 0;
  775.         EGB_palette(work,0,(char *)&plpara);
  776.         }
  777.     }
  778.     break;
  779.  
  780.     case 16:
  781.         EGB_resolution(work,0,10);
  782.     EGB_writePage(work,0);
  783.     EGB_clearScreen(work);
  784.     EGB_displayStart(work,2,2,2);
  785.     EGB_displayStart(work,3,320,240);
  786.     EGB_putBlock(work,0,(char *)¶);
  787.     break;
  788.  
  789.     }
  790.  
  791.     EGB_displayPage(work,0,1);
  792.  
  793.     mos_wait();
  794.  
  795.     EGB_displayPage(work,0,0);
  796.     EGB_resolution(work,0,3);
  797.     EGB_resolution(work,1,3);
  798.     EGB_writePage(work,1);
  799.     DSP_palette();
  800.     EGB_clearScreen(work);
  801.     EGB_writePage(work,0);
  802.     DSP_palette();
  803.     EGB_clearScreen(work);
  804.     DSP_pop_vram(save);
  805.     EGB_displayPage(work,0,3);
  806.     MOS_disp(ON);
  807.  
  808. ENDOF:
  809.     xclose(buf);
  810.     DSP_mos(0);
  811. }
  812. ********************************************/
  813.  
  814. void    DSP_pxx(char *file)
  815. {
  816.     int     n;
  817.     int     objs;
  818.     int     plat;
  819.     int     mode;
  820.     long    size;
  821.     short   *sp;
  822.     char    *data;
  823.     char    *buf;
  824.     BLOCK   para;
  825.     BLOCK   *save;
  826.     struct {
  827.     int    cnt;
  828.     int    col;
  829.     char    b,r,g;
  830.     char    btm;
  831.     } plpara;
  832.  
  833.     if ( (buf = xopen(file)) == NULL ) {
  834.     kakunin("Pxxファイルの読み込みに失敗しました");
  835.     return;
  836.     }
  837.  
  838.     DSP_mos(4);
  839.  
  840.     if ( buf[0] != 0x59 || buf[1] != 0x55 || 
  841.      buf[2] != 0x4B || buf[3] != 0x49 ) {
  842.     kakunin("このファイルはPxx形式ではありません?");
  843.     goto ENDOF;
  844.     }
  845.  
  846.     objs = WORD(buf + 0x10);
  847.     mode = WORD(buf + 0x12);    /* 3 or 12 or 10 */
  848.     plat = (mode == 3 ? 96:(mode == 12 ? 1536:448));
  849.     data = buf + 0x18 + plat;
  850.  
  851.     if ( mode != 3 && mode != 12 && mode != 10 ) {
  852.     kakunin("対応していない画面モ-ドです");
  853.     goto ENDOF;
  854.     }
  855.  
  856.     MOS_disp(OFF);
  857.     if ( screen_flg == FALSE )
  858.     save = DSP_push_vram(0,0,639,479);
  859.     EGB_displayPage(work,0,0);
  860.     EGB_resolution(work,0,mode);
  861.     EGB_writePage(work,0);
  862.     EGB_clearScreen(work);
  863.     if ( mode == 10 ) {
  864.     EGB_displayStart(work,2,2,2);
  865.     EGB_displayStart(work,3,320,240);
  866.     } else {
  867.     sp = (short *)(buf + 0x18);
  868.     for ( n = 0 ; n < (plat / 6) ; n++ ) {
  869.         plpara.cnt = 1;
  870.         plpara.col = n;
  871.         plpara.r = *(sp++) >> 8;
  872.         plpara.g = *(sp++) >> 8;
  873.         plpara.b = *(sp++) >> 8;
  874.         plpara.btm = 0;
  875.         EGB_palette(work,0,(char *)&plpara);
  876.     }
  877.     }
  878.  
  879.     EGB_displayPage(work,0,1);
  880.     para.sel = getds();
  881.  
  882.     while ( objs-- > 0 ) {
  883.     if ( WORD(data) == 0 ) {    /* Haikei */
  884.         size = DWORD(data + 2);
  885.         para.x1 = WORD(data + 6);
  886.         para.y1 = WORD(data + 8);
  887.         para.x2 = WORD(data + 10);
  888.         para.y2 = WORD(data + 12);
  889.         para.ptn = data + 14;
  890.         EGB_putBlock(work,0,(char *)¶);
  891.         data += (14 + size);
  892.  
  893.     } else {            /* Object */
  894.         size = DWORD(data + 2) + DWORD(data + 6);
  895.         para.x1 = WORD(data + 10);
  896.         para.y1 = WORD(data + 12);
  897.         para.x2 = WORD(data + 14);
  898.         para.y2 = WORD(data + 16);
  899.         para.ptn = data + 18;
  900.         EGB_maskData(work,2,(char *)¶);
  901.         data += (18 + size);
  902.     }
  903.  
  904.     }
  905.  
  906.     mos_wait();
  907.  
  908.     EGB_displayPage(work,0,0);
  909.     EGB_resolution(work,0,3);
  910.     EGB_resolution(work,1,3);
  911.     EGB_writePage(work,1);
  912.     DSP_palette();
  913.     EGB_clearScreen(work);
  914.     EGB_writePage(work,0);
  915.     DSP_palette();
  916.     EGB_clearScreen(work);
  917.     if ( screen_flg == FALSE )
  918.     DSP_pop_vram(save);
  919.     EGB_displayPage(work,0,3);
  920.     MOS_disp(ON);
  921.  
  922. ENDOF:
  923.     xclose(buf);
  924.     DSP_mos(0);
  925. }
  926. void    PLAY_snd(file)
  927. char    *file;
  928. {
  929.     int     sw,x,y;
  930.     char    *snd_buf;
  931.  
  932.     SND_pcm_sound_delete(-1);
  933.     SND_pcm_mode_set(1);
  934.  
  935.     if ( (snd_buf = xopen(file)) == NULL ) {
  936.     kakunin("SNDファイルの読み込みに失敗しました");
  937.     return;
  938.     }
  939.  
  940.     DSP_mos(3);
  941.     SND_pan_set(71,64);
  942.     *(int *)(snd_buf+20) = 0;
  943.     SND_pcm_play(71,snd_buf[28],127,snd_buf);
  944.  
  945.     while ( SND_pcm_status(71) ) {
  946.     MOS_rdpos(&sw,&x,&y);
  947.     if ( sw != 0 )
  948.         break;
  949.     }
  950.  
  951.     SND_pcm_play_stop(71);
  952.     SND_pcm_rec_stop();
  953.     xclose(snd_buf);
  954.     DSP_mos(0);
  955. }
  956. void    END_eup()
  957. {
  958.     if ( eup_buf == NULL )
  959.     return;
  960.     SND_eup_play_stop();
  961.     xclose(eup_buf);
  962.     eup_buf = NULL;
  963.     DSP_mos(0);
  964. }
  965. void    PLAY_eup(int md, char *file)
  966. {
  967.     int     i;
  968.     int     sw,x,y;
  969.     int     err,size,signa,tempo;
  970.     char    *p;
  971.     char    tmp[16];
  972.     char    dmy[16];
  973.     char    wrk[80];
  974.  
  975.     END_eup();
  976.     if( (eup_buf = xopen(file)) == NULL ) {
  977.     kakunin("EUPファイルの読み込みに失敗しました");
  978.     return;
  979.     }
  980.  
  981.     DSP_mos(3);
  982.  
  983.     p = &eup_buf[852];        /* trk mute */
  984.     for( i = 0 ; i < 32 ; i++ )
  985.     err = SND_eup_mute_set(i,*(p++));
  986.  
  987.     p = &eup_buf[884];        /* trk port */
  988.     for( i = 0 ; i < 32 ; i++ )
  989.     err = SND_eup_port_set(i,*(p++));
  990.  
  991.     p = &eup_buf[916];        /* trk midi ch */
  992.     for( i = 0 ; i < 32 ; i++ )
  993.     err = SND_eup_midi_ch_set(i,*(p++));
  994.  
  995.     p = &eup_buf[948];        /* trk key bias */
  996.     for( i = 0 ; i < 32 ; i++ )
  997.     err = SND_eup_bias_set(i,*(p++));
  998.  
  999.     p = &eup_buf[980];        /* trk transpose */
  1000.     for( i = 0 ; i < 32 ; i++ )
  1001.     err = SND_eup_transpose_set(i,*(p++));
  1002.  
  1003. /********************
  1004.     channel assign
  1005. *********************/
  1006.  
  1007.     p = &eup_buf[1748];        /* fm midi ch */
  1008.     for( i = 0 ; i < 6 ; i++ )
  1009.     err = SND_midi_ch_assign(i,*(p++));
  1010.  
  1011.     p = &eup_buf[1754];        /* pcm midi ch */
  1012.     for( i = 0 ; i < 8 ; i++ )
  1013.     err = SND_midi_ch_assign(i+64,*(p++));
  1014.  
  1015. /****************
  1016.     bank load
  1017. *****************/
  1018.  
  1019.     SND_pcm_mode_set(0);
  1020.  
  1021.     strncpy(tmp,&eup_buf[1762],8);    /* fm file name */
  1022.     tmp[8] = '\0';
  1023.     if ( tmp[0] != '\0' ) {
  1024.     strcat(tmp,".FMB");
  1025.     strcpy(wrk,file);
  1026.     if ( (p = strrchr(wrk,'\\')) != NULL ) {
  1027.         strcpy(p+1,tmp);
  1028.         p = wrk;
  1029.     } else
  1030.         p = tmp;
  1031.     p = tmp;
  1032.         if ( SND_fm_bank_load(p,dmy) != 0 ) {
  1033.         if ( (p = getins("FMINST",tmp)) == NULL ||
  1034.          SND_fm_bank_load(p,dmy) != 0 )
  1035.         kakunin("%sファイルが見当たりません",tmp);
  1036.     }
  1037.     }
  1038.  
  1039.     strncpy(tmp,&eup_buf[1770],8);    /* pcm file name */
  1040.     tmp[8] = '\0';
  1041.     if ( tmp[0] != '\0' ) {
  1042.     strcat(tmp,".PMB");
  1043.     strcpy(wrk,file);
  1044.     if ( (p = strrchr(wrk,'\\')) != NULL ) {
  1045.         strcpy(p+1,tmp);
  1046.         p = wrk;
  1047.     } else
  1048.         p = tmp;
  1049.     p = tmp;
  1050.         if ( SND_pcm_bank_load(p,dmy) != 0 ) {
  1051.         if ( (p = getins("PCMINST",tmp)) == NULL ||
  1052.          SND_pcm_bank_load(p,dmy) != 0 )
  1053.         kakunin("%sファイルが見当たりません",tmp);
  1054.     }
  1055.     }
  1056.  
  1057. /*******************
  1058.     play eup file
  1059. ********************/
  1060.  
  1061.     p = &eup_buf[2048];        /* data top */
  1062.     size = *((int *)p); p += 4;
  1063.     signa = *(p++);
  1064.     tempo = *(p++);
  1065.  
  1066.     SND_eup_loop_set(0);
  1067.     SND_eup_tempo_set(tempo);
  1068.     SND_eup_play_start(p,size,signa);
  1069.  
  1070.     if ( md != FALSE )
  1071.     goto ENDOF;
  1072.  
  1073.     EUP_open();
  1074.  
  1075.     while ( SND_eup_stat_flag() ) {
  1076.     EUP_chk(SND_eup_stat_ptr());
  1077.     MOS_rdpos(&sw,&x,&y);
  1078.     if ( sw != 0 )
  1079.         break;
  1080.     }
  1081.  
  1082.     EUP_close();
  1083.  
  1084.     SND_eup_play_stop();
  1085.     xclose(eup_buf);
  1086.     eup_buf = NULL;
  1087. ENDOF:
  1088.     DSP_mos(0);
  1089. }
  1090. int    strhcmp(char *s, char *p)
  1091. {
  1092.     while ( *s != '\0' ) {
  1093.     if ( toupper(*s) != toupper(*p) )
  1094.         return (-1);
  1095.     s++;
  1096.     p++;
  1097.     }
  1098.     return (*p == '\0' ? 0:1);
  1099. }
  1100. int    JOKE_run(char *file)
  1101. {
  1102.     char    *p;
  1103.     DIR     *dirp;
  1104.     DIRECT  *dp;
  1105.     char    tmp[128];
  1106.  
  1107.     if ( strchr(file,'*') != NULL ||
  1108.      strchr(file,'?') != NULL ) {
  1109.     strcpy(tmp,file);
  1110.     if ( (p = strrchr(tmp,'\\')) != NULL ||
  1111.          (p = strrchr(tmp,':'))  != NULL )
  1112.         p++;
  1113.     else
  1114.         p = tmp;
  1115.     if ( (dirp = opendir(file)) == NULL )
  1116.         return FALSE;
  1117.     while ( (dp = readdir(dirp)) != NULL && !IS_DIR(dp) ) {
  1118.         strcpy(p,dp->d_name);        
  1119.         JOKE_run(tmp);
  1120.     }
  1121.     closedir(dirp);
  1122.     return TRUE;
  1123.     }
  1124.  
  1125.     if ( (p = strrchr(file,'\\')) == NULL )
  1126.     p = file;
  1127.     if ( (p = strrchr(p,'.')) == NULL )
  1128.     return FALSE;
  1129.  
  1130.     if ( strhcmp(p,".TIF") == 0 )
  1131.     TIFF_disp(file);
  1132.     else if ( strhcmp(p,".P16") == 0 ||
  1133.           strhcmp(p,".P25") == 0 ||
  1134.           strhcmp(p,".P32") == 0 )
  1135.     DSP_pxx(file);
  1136.     else if ( strhcmp(p,".SND") == 0 )
  1137.     PLAY_snd(file);
  1138.     else if ( strhcmp(p,".EUP") == 0 )
  1139.     PLAY_eup(FALSE,file);
  1140.     else if ( strhcmp(p,".QQQ") == 0 )
  1141.     CMDS_file(file);
  1142.     else
  1143.     return FALSE;
  1144.  
  1145.     return TRUE;
  1146. }
  1147. void    SCRN_saver(int sw)
  1148. {
  1149.     static BLOCK *sv_pa = NULL;
  1150.  
  1151.     if ( sw != 0 ) {
  1152.     if ( sv_pa == NULL )
  1153.         free(sv_pa);
  1154.     MOS_disp(OFF);
  1155.     if ( (sv_pa = DSP_push_vram(0,0,639,479)) != NULL )
  1156.         screen_flg = TRUE;
  1157.     MOS_disp(ON);
  1158.     } else {
  1159.     MOS_disp(OFF);
  1160.     DSP_pop_vram(sv_pa);
  1161.     MOS_disp(ON);
  1162.     sv_pa = NULL;
  1163.     screen_flg = FALSE;
  1164.     }
  1165. }
  1166.